package com.google.code.easyparking.metier;

import java.util.HashMap;

public class VehiculeFactory {
	
	private static final VehiculeFactory instance = new VehiculeFactory();
	
	public static VehiculeFactory getInstance () {
		return instance;
	}
	
	public final HashMap<String, Vehicule> hashVehicules = new HashMap<String, Vehicule>();
	
	public IVehicule getVehicule(String plaque, double longeur, double hauteur) {
		plaque = plaque.trim().toUpperCase();
		Vehicule vehicule = null;
		if (hashVehicules.containsKey(plaque)) {
			vehicule = hashVehicules.get(plaque);
		} else {
			vehicule = new Vehicule(plaque, longeur, hauteur);
			hashVehicules.put(plaque, vehicule);
		}
		return vehicule;
	}
}
